<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="dromara.org" />
	<meta name="description" content="dromara.org" />
	<!-- 网页标签标题 -->
	<title>dromara(Open source organization)</title>
	<link rel="shortcut icon" href="/website/img/docsite.ico"/>
	<link rel="stylesheet" href="/website/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/website/en-us/index.html"><img class="logo" src="/website/img/dromara.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="/website/img/system/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/website/en-us/index.html" target="_self">Home</a><div class="sub-menu"><ul></ul></div></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="#">Document</a><div class="sub-menu"><ul><li><a href="/website/en-us/docs/soul/soul.html" target="_self">Soul</a></li><li><a href="/website/en-us/docs/hmily/index.html" target="_self">Hmily</a></li></ul></div></li><li class="menu-item menu-item-normal"><a href="/website/en-us/blog/index.html" target="_self">Blog</a><div class="sub-menu"><ul></ul></div></li><li class="menu-item menu-item-normal"><a href="/website/en-us/community/index.html" target="_self">Community</a><div class="sub-menu"><ul></ul></div></li></ul></div></div></header><section class="content-section"><div class="sidemenu" id="menu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Soul</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/en-us/docs/soul/soul.html" target="_self">Home  </a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/en-us/docs/soul/team.html" target="_self">Team</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/en-us/docs/soul/db.html" target="_self">Database Design</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/en-us/docs/soul/config.html" target="_self">Config</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/en-us/docs/soul/dataSync.html" target="_self">DataSync</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/en-us/docs/soul/metaData.html" target="_self">MetaData</a></li><li style="height:612px;overflow:hidden" class="menu-item menu-item-level-2"><span>User Document<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/setup.html" target="_self">Set up</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/user-http.html" target="_self">Http proxy</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/user-dubbo.html" target="_self">Dubbo proxy</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/user-springcloud.html" target="_self">Spring cloud proxy</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/selector.html" target="_self">Selector and Rule</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/user-dataSync.html" target="_self">Use data sync</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-divide.html" target="_self">Divide Plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-dubbo.html" target="_self">Dubbo plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-springcloud.html" target="_self">Spring cloud plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-rateLimiter.html" target="_self">RateLimiter plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-hystrix.html" target="_self">Hystrix plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-monitor.html" target="_self">Monitor plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-waf.html" target="_self">Waf plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-sign.html" target="_self">Sign plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-rewrite.html" target="_self">Rewrite plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/plugin-websocket.html" target="_self">Websocket plugin</a></li></ul></li><li style="height:360px;overflow:hidden" class="menu-item menu-item-level-2"><span>Developer Guide<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-filter.html" target="_self">Custom filter </a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-plugin.html" target="_self">Custom plugin</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-file.html" target="_self">File and Image</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-iphost.html" target="_self">Custom parsing IP and Host</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-result.html" target="_self">Custom result</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-sign.html" target="_self">Custom sign algorithm</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-client.html" target="_self">Developer soul client</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-thread.html" target="_self">Thread</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/dev-netty.html" target="_self">Soul optimize</a></li></ul></li><li style="height:144px;overflow:hidden" class="menu-item menu-item-level-2"><span>Community<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/contributor.html" target="_self">Contributor</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/committer.html" target="_self">Committer</a></li><li class="menu-item menu-item-level-3"><a href="/website/en-us/docs/soul/code-conduct.html" target="_self">Code conduct</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body" id="doc-body"><h2>Features</h2>
<ul>
<li>
<p>This chapter is a guide about integrating dubbo service with soul gateway.</p>
</li>
<li>
<p>Support alibaba dubbo（&lt; 2.7.x）and apache dubbo (&gt;=2.7.x).</p>
</li>
<li>
<p>Pls start <code>soul-admin</code> successfully beofore integrating , and <a href="setup.md">Environement Setup</a> is Ok.</p>
</li>
</ul>
<h2>Configure soul gateway as dubbo proxy</h2>
<ul>
<li>
<p>Add these dependencies in gateway's <code>pom.xml</code>：</p>
<ul>
<li>alibaba dubbo user, configure the dubbo version and registry center with yours.</li>
</ul>
</li>
</ul>
<pre><code class="language-xml"> 
         <span class="hljs-comment">&lt;!--soul alibaba dubbo plugin start--&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>soul-spring-boot-starter-plugin-alibaba-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>${last.version}<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
          <span class="hljs-comment">&lt;!-- soul  alibaba dubbo plugin end--&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>com.alibaba<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.6.5<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.curator<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>curator-client<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.curator<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>curator-framework<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.curator<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>curator-recipes<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
      
</code></pre>
<ul>
<li>apache dubbo user, configure the dubbo version and registry center with yours.</li>
</ul>
<pre><code class="language-xml">
         <span class="hljs-comment">&lt;!--soul apache dubbo plugin start--&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>soul-spring-boot-starter-plugin-apache-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>${last.version}<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-comment">&lt;!--soul apache dubbo plugin end--&gt;</span>

         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.7.5<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
          <span class="hljs-comment">&lt;!-- Dubbo Nacos registry dependency start --&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>dubbo-registry-nacos<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.7.5<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>com.alibaba.nacos<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>nacos-client<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.1.4<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-comment">&lt;!-- Dubbo Nacos registry dependency  end--&gt;</span>

         <span class="hljs-comment">&lt;!-- Dubbo zookeeper registry dependency start--&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.curator<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>curator-client<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.curator<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>curator-framework<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.curator<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>curator-recipes<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
         <span class="hljs-comment">&lt;!-- Dubbo zookeeper registry dependency end --&gt;</span>
</code></pre>
<ul>
<li>restart gateway service.</li>
</ul>
<h2>dubbo integration with gateway,pls refer to : <a href="https://github.com/Dromara/soul/tree/master/soul-test/soul-test-dubbo">soul-test-dubbo</a></h2>
<ul>
<li>
<p>alibaba dubbo user</p>
<ul>
<li>
<p>springboot</p>
<ul>
<li>Add these dependencies:</li>
</ul>
</li>
</ul>
</li>
</ul>
<pre><code class="language-xml">       <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>soul-spring-boot-starter-client-alibaba-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>${last.version}<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
       <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<ul>
<li>Add these config values in your yaml file ：</li>
</ul>
<pre><code class="language-yaml">   <span class="hljs-attr">soul:</span>
     <span class="hljs-attr">dubbo:</span>
       <span class="hljs-attr">adminUrl:</span> <span class="hljs-string">http://localhost:9095</span>
       <span class="hljs-attr">contextPath:</span> <span class="hljs-string">/dubbo</span>
       <span class="hljs-attr">appName:</span> <span class="hljs-string">dubbo</span>    
      <span class="hljs-comment"># adminUrl: 'ip + port' of your soul-admin project, pls note 'http://' is necessary.</span>
      <span class="hljs-comment"># contextPath: your project's route prefix through soul gateway, such as /order ，/product etc，gateway will route based on it.</span>
      <span class="hljs-comment"># appName：your project name,default value is the application name in dubbo config.</span>
</code></pre>
<ul>
<li>
<p>spring</p>
<ul>
<li>Add these dependencies：</li>
</ul>
</li>
</ul>
<pre><code class="language-xml">      <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>soul-client-alibaba-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>${last.version}<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
       <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<ul>
<li>Inject these properties into your Sping beans XML file：</li>
</ul>
<pre><code class="language-xml">        <span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">id</span> =<span class="hljs-string">"alibabaDubboServiceBeanPostProcessor"</span> <span class="hljs-attr">class</span> =<span class="hljs-string">"org.dromara.soul.client.alibaba.dubbo.AlibabaDubboServiceBeanPostProcessor"</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">constructor-arg</span>  <span class="hljs-attr">ref</span>=<span class="hljs-string">"dubboConfig"</span>/&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
        
        <span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"dubboConfig"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"org.dromara.soul.client.dubbo.common.config.DubboConfig"</span>&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"adminUrl"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"http://localhost:9095"</span>/&gt;</span>     
             <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"contextPath"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"/your contextPath"</span>/&gt;</span>
             <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"appName"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"your application name"</span>/&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
</code></pre>
<ul>
<li>
<p>apache dubbo user</p>
<ul>
<li>
<p>springboot</p>
<ul>
<li>add these dependencies:</li>
</ul>
</li>
</ul>
</li>
</ul>
<pre><code class="language-xml">       <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>soul-spring-boot-starter-client-apache-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>${last.version}<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
       <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<ul>
<li>Add these config values in your yaml file ：</li>
</ul>
<pre><code class="language-yaml">    <span class="hljs-attr">soul:</span>
      <span class="hljs-attr">dubbo:</span>
        <span class="hljs-attr">adminUrl:</span> <span class="hljs-string">http://localhost:9095</span>
        <span class="hljs-attr">contextPath:</span> <span class="hljs-string">/dubbo</span>
        <span class="hljs-attr">appName:</span> <span class="hljs-string">dubbo</span>
   
       <span class="hljs-comment"># adminUrl: 'ip + port' of your soul-admin project, pls note 'http://' is necessary.</span>
       <span class="hljs-comment"># contextPath: your project's route prefix through soul gateway, such as /order ，/product etc，gateway will route based on it.</span>
       <span class="hljs-comment"># appName：your project name,default value is the application name in dubbo config.</span>
</code></pre>
<ul>
<li>
<p>spring</p>
<ul>
<li>Add these dependencies ：</li>
</ul>
<pre><code class="language-xml">  <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.dromara<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>soul-client-apache-dubbo<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>${last.version}<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
   <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
</li>
<li>
<p>Injecct these properties into your Spring beans XML file ：</p>
</li>
</ul>
<pre><code class="language-xml">         <span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">id</span> =<span class="hljs-string">"apacheDubboServiceBeanPostProcessor"</span> <span class="hljs-attr">class</span> =<span class="hljs-string">"org.dromara.soul.client.apache.dubbo.ApacheDubboServiceBeanPostProcessor"</span>&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">constructor-arg</span>  <span class="hljs-attr">ref</span>=<span class="hljs-string">"dubboConfig"</span>/&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
         
         <span class="hljs-tag">&lt;<span class="hljs-name">bean</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"dubboConfig"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"org.dromara.soul.client.dubbo.common.config.DubboConfig"</span>&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"adminUrl"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"http://localhost:9095"</span>/&gt;</span>     
              <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"contextPath"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"/your contextPath"</span>/&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"appName"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"your application name"</span>/&gt;</span>
         <span class="hljs-tag">&lt;/<span class="hljs-name">bean</span>&gt;</span>
</code></pre>
<h2>dubbo configuration</h2>
<ul>
<li>
<p>firstly enable <code>dubbo</code> option in <code>soul-admin</code>.</p>
</li>
<li>
<p>then configure your registry address in <code>dubbo</code>.</p>
</li>
</ul>
<pre><code class="language-yaml"><span class="hljs-string">{"register":"zookeeper://localhost:2181"}</span>   <span class="hljs-string">or</span> <span class="hljs-string">{"register":"nacos://localhost:8848"}</span>

</code></pre>
<h2>configure the interface with gateway</h2>
<ul>
<li>
<p>you can add the annotation <code>@SoulDubboClient</code> to your dubbo service implementation class, so that the interface method will be configured with gateway.</p>
</li>
<li>
<p>start your provider and get the log <code>dubbo client register success</code>，then your dubbo interface has been added with soul gateway successfully.Pls refer to <code>soul-test-dubbo</code>
project.</p>
</li>
</ul>
<h2>dubbo user request and parameter explanation.</h2>
<ul>
<li>
<p>communicate with dubbo service through Http transport protocol.</p>
</li>
<li>
<p>soul gateway need a route prefix which configured when accessing the project.</p>
</li>
</ul>
<pre><code class="language-yaml"><span class="hljs-comment"># for example: you have an order service and it has a interface, his registry address: /order/test/save</span>

<span class="hljs-comment"># now we can communicate with gateway through POST request http://localhost:9195/order/test/save</span>

<span class="hljs-comment"># localhost:9195 is gateway's ip port，default port is 9195 ，/order is the contextPath you set through gateway.</span>

</code></pre>
<ul>
<li>
<p>parameter deliver：</p>
<ul>
<li>
<p>communicate with gateway through body or json of http post request.</p>
</li>
<li>
<p>more parameter types, pls refer to the interface definition in  <a href="https://github.com/Dromara/soul/tree/master/soul-test/soul-test-dubbo">soul-test-dubbo</a> and parameter passing
method.</p>
</li>
</ul>
</li>
<li>
<p>Single java bean parameter type (defaulta).</p>
</li>
<li>
<p>Multi-parameter type support, add this config value in gateway's yaml file:</p>
</li>
</ul>
<pre><code class="language-yaml"><span class="hljs-attr">soul :</span>
    <span class="hljs-attr">dubbo :</span>
      <span class="hljs-attr">parameter:</span> <span class="hljs-string">multi</span>
</code></pre>
<ul>
<li>
<p>Support for customized multi-parameter type</p>
<ul>
<li>create a new implementation class A in your gateway project of <code>org.dromara.soul.web.dubbo.DubboParamResolveService</code>.</li>
</ul>
</li>
</ul>
<pre><code class="language-java">  <span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">DubboParamResolveService</span> </span>{
  
      <span class="hljs-comment">/**
       * Build parameter pair.
       * this is Resolve http body to get dubbo param.
       *
       * <span class="hljs-doctag">@param</span> body           the body
       * <span class="hljs-doctag">@param</span> parameterTypes the parameter types
       * <span class="hljs-doctag">@return</span> the pair
       */</span>
      Pair&lt;String[], Object[]&gt; buildParameter(String body, String parameterTypes);
  }
</code></pre>
<ul>
<li>
<p><code>body</code> is the json string in http request.</p>
</li>
<li>
<p><code>parameterTypes</code>: the list of method parameter types that are matched，split with <code>,</code>.</p>
</li>
<li>
<p>in Pair，left is parmeter type，right is parameter value, it's the standard of dubbo generalization calls.</p>
</li>
<li>
<p>Inject your class into Spring bean, cover the default implementation.</p>
</li>
</ul>
<pre><code class="language-java"> <span class="hljs-meta">@Bean</span>
 <span class="hljs-function"><span class="hljs-keyword">public</span> DubboParamResolveService <span class="hljs-title">A</span><span class="hljs-params">()</span> </span>{
         <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> A();
 }
</code></pre>
<h2>Let's break down this process: http --&gt; gateway --&gt; dubbo provider</h2>
<ul>
<li>
<p>It basically switches from HTTP request to Dubbo protocol，then invoke Dubbo service and return to the result.</p>
</li>
<li>
<p>Two things need to notice after intgeration with gateway, one is the added annoation <code>@SoulDubboClient</code>, another is a path used to speicify the request path.</p>
</li>
<li>
<p>And you added a config value of <code>contextPath</code>.</p>
</li>
<li>
<p>If you still remember, then we can start.</p>
</li>
<li>
<p>If you have a function like this, the config value in contextPath is <code>/dubbo</code></p>
</li>
</ul>
<pre><code class="language-java">    <span class="hljs-meta">@Override</span>
    @<span class="hljs-meta">@SoulDubboClient</span>(path = <span class="hljs-string">"/insert"</span>, desc = <span class="hljs-string">"insert data"</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> DubboTest <span class="hljs-title">insert</span><span class="hljs-params">(<span class="hljs-keyword">final</span> DubboTest dubboTest)</span> </span>{
        <span class="hljs-keyword">return</span> dubboTest;
    }

</code></pre>
<ul>
<li>
<p>so our request path is: <a href="http://localhost:9195/dubbo/insert">http://localhost:9195/dubbo/insert</a> ,localhost:9195 is the gateway's domain name,if you changed before,so does with yours here..</p>
</li>
<li>
<p>how about the request parameter？<code>DubboTest</code> is a java bean object，has 2 parameters，id and name ，so we can transfer the value's json type through request body.</p>
</li>
</ul>
<pre><code>{&quot;id&quot;:&quot;1234&quot;,&quot;name&quot;:&quot;XIAO5y&quot;}

</code></pre>
<ul>
<li>if your interface has no parameter, then the value is:</li>
</ul>
<pre><code>{}

</code></pre>
<ul>
<li>if your interface has multi-parameter, pls refer to the guide above.</li>
</ul>
</div></section><footer class="footer-container"><div class="footer-body"><img src="/website/img/dromara.png"/><div class="cols-container"><div class="col col-12"><h3>Disclaimer</h3><p>Any unit or individual reprint all relevant information of this website, please indicate the source.</p></div><div class="col col-6"><dl><dt>Document</dt><dd><a href="/website/en-us/docs/soul/soul.html" target="_self">Overview </a></dd><dd><a href="/website/en-us/docs/soul/soul.html" target="_self">Stat up</a></dd><dd><a href="/website/en-us/docs/soul/soul.html" target="_self">Developer Guide</a></dd></dl></div><div class="col col-6"><dl><dt>Resource</dt><dd><a href="/website/en-us/blog/index.html" target="_self">Blog</a></dd><dd><a href="/website/en-us/community/index.html" target="_self">Community</a></dd></dl></div></div><div class="copyright"><span>Copyright ©2020 xiaoyu@apache.org by xiaoyu</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '/website';
  </script>
	<script src="/website/build/documentation.js"></script>
</body>
</html>